# 从系统凭据、环境变量等获取账号密码等敏感信息

import os
import keyring

# mysql密码
# 从凭据管理器获取密码
def get_password():
    if os.name == "nt":           # 'nt' 表示 Windows
        service_name = "matrix"   # 凭据的"Internet地址"
        user = "matrix"           # 凭据的"用户名"
        res = keyring.get_password(service_name, user)

        if res and len(res.split("||")) == 2:
            user, password = res.split("||")
            return {'user':user, 'password':password,'system':'wimndows'}
        else:
            print('ERR get system info err .')
            return False

    elif os.name == "posix":  #  Linux/Unix/macOS
       pass

    else:
        print("未知系统")
        pass

if __name__ == '__main__':
    pass